<!-- 搜索表单 -->
<template>
  <ele-card :body-style="{ paddingBottom: '2px' }">
    <el-form label-width="72px" @keyup.enter="search" inline>
      <el-form-item label="分类">
        <el-radio-group v-model="form.cate" @change="search">
          <el-radio-button label="全部">全部</el-radio-button>
          <el-radio-button label="账单还款">账单还款</el-radio-button>
          <el-radio-button label="出单收款">出单收款</el-radio-button>
          <el-radio-button label="保险支付">保险支付</el-radio-button>
          <el-radio-button label="保险结账">保险结账</el-radio-button>
        </el-radio-group>
      </el-form-item>
      <br />
      <el-form-item label="类型">
        <el-radio-group v-model="form.type" @change="search">
          <el-radio-button label="全部">全部</el-radio-button>
          <el-radio-button label="支出">支出</el-radio-button>
          <el-radio-button label="收入">收入</el-radio-button>
        </el-radio-group>
      </el-form-item>
      <br />
      <el-form-item label="状态">
        <el-radio-group v-model="form.status" @change="search">
          <el-radio-button :value="0" :label="0">
            待复核
            <span v-if="props.badgeData.judge > 0" class="red my-badge">{{
              props.badgeData.judge
            }}</span>
          </el-radio-button>
          <el-radio-button :value="200" :label="200">已复核</el-radio-button>
        </el-radio-group>
      </el-form-item>
    </el-form>
  </ele-card>
</template>

<script setup>
  import { ref } from 'vue';
  import { useFormData } from '@/utils/use-form-data';
  const emit = defineEmits(['search']);

  const props = defineProps({
    action: String,
    badgeData: Object
  });

  /** 表单数据 */
  const [form] = useFormData({
    cate: '全部',
    type: '全部',
    status: 0
  });

  /** 搜索 */
  const search = () => {
    console.log(form);
    emit('search', { ...form });
  };
</script>
